﻿
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NetCore.ORM.EF;
namespace NetCore.Api.Model
{
    /// <summary>
    /// 接口用户表EF 字段映射
    /// </summary>
    public partial class APIUsersMap : ClassMap<APIUsersEntity>
    {
        public override void Configure(EntityTypeBuilder<APIUsersEntity>
        builder)
        {
            builder.ToTable<APIUsersEntity>("API_Users");
            base.Configure(builder);
            builder.HasKey(x => x.UserNo);
            builder.Property(x => x.UserNo).HasColumnName("UserNo").HasMaxLength(20);

            /// <summary>
            /// 用户名称
            /// </summary>
            builder.Property(x => x.UserName).HasColumnName("UserName").HasMaxLength(50).IsRequired(true);

            /// <summary>
            /// 密码
            /// </summary>
            builder.Property(x => x.Password).HasColumnName("Password").HasMaxLength(50).IsRequired(true);

            /// <summary>
            /// 密钥
            /// </summary>
            builder.Property(x => x.Md5Key).HasColumnName("Md5Key").HasMaxLength(50).IsRequired(true);

            /// <summary>
            /// 最后登录时间
            /// </summary>
            builder.Property(x => x.LastLoginTime).HasColumnName("LastLoginTime").HasColumnType("datetime");

            /// <summary>
            /// 缓存时间
            /// </summary>
            builder.Property(x => x.CacheTime).HasColumnName("CacheTime");

            /// <summary>
            /// 描述
            /// </summary>
            builder.Property(x => x.Remark).HasColumnName("Remark").HasMaxLength(500).IsRequired(false);

            /// <summary>
            /// 创建人
            /// </summary>
            builder.Property(x => x.CreateBy).HasColumnName("CreateBy").HasMaxLength(50).IsRequired(true);

            /// <summary>
            /// 创建时间
            /// </summary>
            builder.Property(x => x.CreateDate).HasColumnName("CreateDate").HasColumnType("datetime").IsRequired(true);

            /// <summary>
            /// 修改人
            /// </summary>
            builder.Property(x => x.LastModifyUserId).HasColumnName("LastModifyUserId").HasMaxLength(50).IsRequired(true);

            /// <summary>
            /// 修改时间
            /// </summary>
            builder.Property(x => x.LastModifyDate).HasColumnName("LastModifyDate").HasColumnType("datetime").IsRequired(true);

            /// <summary>
            /// 是否删除
            /// </summary>
            builder.Property(x => x.IsDeleted).HasColumnName("IsDeleted").HasDefaultValue(false);
        }
    }
}
